package book.ch3.CompositeObject;
class SimpleObject{
	private String s;
	SimpleObject(){
		System.out.println("SimpleObject()");
		s=new String("Constructed");
	}
	public String toString(){
		return s;
	}
}
public class CompositeObject {
	private String s1=new String("Happy");
			String s2="Happy";
			String s3,s4;
	SimpleObject simpleObject;
	int i;
	CompositeObject(){
		System.out.println("Inside CompositeObject()");
		s3=new String("Joy");
		i=47;
		simpleObject=new SimpleObject();
	}
	void print(){
		if(s4==null) s4=new String("Joy");
		System.out.println("s1="+s1);
		System.out.println("s2="+s2);
		System.out.println("s3="+s3);
		System.out.println("s4="+s4);
		System.out.println("i="+i);
		System.out.println("simpleObject="+simpleObject);
	}
	public static void main(String[] args) {
		CompositeObject b=new CompositeObject();
		b.print();

	}

}
